<template>
  <!--检查详情 无问题 -->
  <div>
    <mu-expansion-panel v-if="obj" class="noshadow" :expand="true">
      <div slot="header" class="noshadow_tit">
        <div><span class="noshadow_tit_con">检查人：</span><span
          class="noshadow_tit_name">{{obj.checkUserName || '---'}}</span></div>
        <div><span class="noshadow_tit_con">检查时间：</span><span
          class="noshadow_tit_name">{{obj.checkTime || '---'}}</span>
        </div>
      </div>
      <section class="box">
        <p class="line-list textdot">
          项目名称：<span class="line-list-con">{{obj.orgName || '---'}}</span>
        </p>
        <p class="line-list">
          检查类型：<span class="line-list-con">{{obj.checkTypeName || '---'}}</span>
        </p>
        <p class="line-list">
          所属区域：<span class="line-list-con">{{obj.areaName || '---'}}</span>
        </p>
        <p class="line-list textdot">
          检查部位：<span class="line-list-con">{{obj.checkParts||'---'}}</span>
        </p>
        <p class="line-list">
          检查结果：<span class="line-list-con">{{obj.checkResult == '1' ? '有问题': '无问题'}}</span>
        </p>
        <p class="line-list">
          问题类型：<span class="line-list-con">{{obj.problemTypeName || '---'}}</span>
        </p>
        <p class="line-list">
          问题等级：
          <span class="line-list-con" v-if="obj.problemLevel == '1'">一般问题</span>
          <span class="line-list-con" v-if="obj.problemLevel == '2'">较大问题</span>
          <span class="line-list-con" v-if="obj.problemLevel == '3'">重大问题</span>
        </p>
        <section class=" line-list img-box">
          现场照片：
          <div class="img-con" >
            <img class="img" :preview="index" v-for="(i,index) in handUrl(obj.proScenePhotos)" :key="index" :src="i"/>
          </div>
        </section>
        <Preview :imgUrls="handUrl(obj.proScenePhotos)" :open="imgPreview" @close="closeDialog"></Preview>
        <p class="line-list">
          问题描述：<span class="line-list-con">{{obj.problemDescription || '---'}}</span>
        </p>
        <p class="line-list">
          平面图标记：
          <span class="line-list-con">
            <!--<img :src="obj.photoUrl" alt="">-->
            <MapShow :width="'100%'" :url="obj.photoUrl"
                     :points="handPoint(obj.floorPlanTag)"
                     enableClick
                     :single="true"
                     readonly></MapShow>
          </span>
        </p>
        <p class="line-list">
          整改期限：<span class="line-list-con">{{obj.endTime || '---'}}</span>
        </p>
        <p class="line-list">
          整改要求：<span class="line-list-con">{{obj.rectRequirements || '---'}}</span>
        </p>
        <p class="line-list">
          责任单位：<span class="line-list-con">{{obj.responsibleUnitName || '--'}}</span>
        </p>
        <p class="line-list">
          整改责任人：<span class="line-list-con">{{obj.responsibleUserName || '---'}}</span>
        </p>
        <p class="line-list">
          复查人：<span class="line-list-con">{{obj.reviewUserName || '---'}}</span>
        </p>
        <p class="line-list">
          抄送人：<span v-for="(i,index) in obj.copyList" :key="index" class="line-list-con">{{i.userName || '---'}} </span>
        </p>
        <div class="line-list">
          检查人签名：
          <div class="img-con" v-if="obj.checkSignature">
            <img preview="0" class="img" :src="obj.checkSignature"/>
          </div>
          <span v-else>暂无签名</span>
        </div>
        <!-- <div class="lan-card-footer">
          <div class="lan-btn big danger" >
              拒绝
          </div>
          <div class="lan-btn big default" >
              同意
          </div>
        </div> -->
      </section>
    </mu-expansion-panel>
  </div>
</template>

<script>
  import Preview from './../preview/ImgPreview'

  export default {
    components: {
      Preview
    },
    name: "noProblem",
    filters: {
      result(val) {
        if (val == 0) {
          return '无问题'
        } else if (val == 1) {
          return '有问题'
        } else {
          return '---'
        }
      },
    },
    data() {
      return {
        imgPreview: false,
      }
    },
    props: {
      obj: {
        type: Object,
        default: function () {
          return ""
        }
      },
    },
    methods: {
      handPoint(str){
        if(!str){
          return []
        }
        let arr = [];
        let data = JSON.parse(str);
        for(let i = 0;i<data.length;i++){
          let p = data[i].split(',');
          arr.push({
            left: p[0],
            top: p[1],
            lng: p[0],
            lat: p[1],
          })
        }
        console.log(arr);
        return arr;
      },
      handUrl(str){
        if (!str) {
          return []
        } else {
          try {
            if(str.indexOf("[") > -1){
              return JSON.parse(str)
            }else{
              return str.split(',')
            }
          }catch (e) {

          }

        }
      },
      closeDialog() {
        this.imgPreview = false
      },

    }
  }
</script>

<style scoped lang="scss">
  @import "assign.scss";
</style>
